import request from '@/utils/request'

export function dataListApi(params) {
  return request({
    url: '/api/menu/data',
    method: 'get',
    params
  })
}



export function findByIdApi(id) {
  return request({
    url: '/api/menu/'+id,
    method: 'get'
  })
}

// 新增字典类型
export function addApi(data) {
  return request({
    url: '/api/menu',
    method: 'post',
    data: data
  })
}

// 修改字典类型
export function editApi(data) {
  return request({
    url: '/api/menu',
    method: 'put',
    data: data
  })
}

// 删除字典类型
export function deleteApi(ids) {
  return request({
    url: '/api/menu/' + ids,
    method: 'delete'
  })
}

// 查询菜单下拉树结构
export function treeselect() {
  return request({
    url: '/api/menu/treeselect',
    method: 'get'
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
  return request({
    url: '/api/menu/rolemenu/' + roleId,
    method: 'get'
  })
}


// 获取路由
export const getRouters = () => {
  return request({
    url: '/api/getRouters',
    method: 'get'
  })
}